{extend name="Base/base"/}

{block name="body"}
    <div class="main-title">
        <h2>
            订单管理                    </h2>
    </div>

    <div style="margin-bottom: 10px;" class="hide" id="search_form">

        <style>
            .tb_search td{
                padding: 5px 10px;
            }
        </style>
        <form id="searchForm" method="get" action="/uctoo/admin.php?s=/shop/order.html" class="form-dont-clear-url-param">
            <div class="search-form  cf " style="margin-bottom: 10px">
                <table class="tb_search">

                    <!--判断搜索选项是TEXT还是SELECT-->
                    <tbody><tr style="line-height: 28px">
                        <td>
                        </td>
                        <td>
                            <input style="float: none" type="text" name="id" class="search-input form-control form-input-width" value="">
                        </td>
                        <td>
                            订单id								</td>
                    </tr><!--判断搜索选项是TEXT还是SELECT-->
                    <tr style="line-height: 28px">
                        <td>
                        </td>
                        <td>
                            <input style="float: none" type="text" name="key" class="search-input form-control form-input-width" value="">
                        </td>
                        <td>
                            商品名								</td>
                    </tr>				<tr><td></td>
                        <td><input type="hidden" name="status" value=""></td>
                        <td></td>
                    </tr><tr><td></td>
                        <td><input type="hidden" name="show_type" value=""></td>
                        <td></td>
                    </tr>            <tr><td></td>
                        <td><input type="submit" class="btn" value="确定"> <button class="btn ajax-post btn" onclick="toggle_search()">关闭</button></td>
                        <td></td>
                    </tr>
                    </tbody></table>
            </div>
        </form>
        <div style="border-top:1px solid #ccc;border-bottom: 1px solid white"></div>
    </div>
    <!-- 按钮工具栏 -->
    <div class="with-padding">
        <div class="fl">
            <button class="btn submit-btn" url="?status=-1" target-form="ids" style="padding: 6px 16px;" onclick="toggle_search()">搜索</button>
            <a href="/uctoo/admin.php?s=/shop/order.html" class="btn btn-ajax btn-success btn">全部订单</a>&nbsp;

            <!-- 选择框select -->
            <div style="float: right;">
                <style>
                    .oneselect{
                        display: inline-block;
                        margin-left: 10px;
                    }
                    .oneselect .title{
                        float: left;
                        line-height: 32px;
                    }
                    .oneselect .select_box{
                        float: left;
                        line-height: 32px;
                    }
                    .oneselect .select_box select{
                        min-width: 200px;
                    }
                </style>
                <form id="selectForm" method="get" action="/uctoo/admin.php?s=/shop/order.html" class="form-dont-clear-url-param">
                    <input type="hidden" name="id" value="">
                    <input type="hidden" name="key" value="">
                    <div class="oneselect">
                        <div class="title">订单状态：</div>
                        <div class="select_box">
                            <select name="status" data-role="select_text" class="form-control">
                                <option value="0" selected="">全部</option><option value="1">待付款</option><option value="2">待发货</option><option value="3">待收货</option><option value="8">待退款</option><option value="4">已完成</option><option value="5">已评价</option><option value="10">已取消</option><option value="9">卖家取消</option><option value="6">已退款</option>                            </select>
                        </div>
                    </div><div class="oneselect">
                    <div class="title">显示模式:</div>
                    <div class="select_box">
                        <select name="show_type" data-role="select_text" class="form-control">
                            <option value="0" selected="">订单信息</option><option value="1">订单状态</option>                            </select>
                    </div>
                </div>                </form>
            </div>
        </div>

    </div>


    <!-- 数据表格 -->
    <div class="with-padding" stype="width:auto; overflow: auto;">
        <table id="table-data" class="table table-bordered table-striped table-hover">
            <!-- 表头 -->
            <thead>
            <tr>
                <th class="row-selected row-selected" style="width: 20px">
                    <input class="check-all" type="checkbox">
                </th>
                <th>订单id</th><th>用户</th><th>订单状态</th><th>总价/分</th><th>已优惠的价格</th><th>邮费</th><th>商品种数</th><th>商品总数</th><th>操作</th>            </tr>
            </thead>

            <!-- 列表 -->
            <tbody>
            </tbody>
        </table>
    </div>
    <!-- 分页 -->
    <div class="with-padding">
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    $(function () {
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        //点击排序
        $('.list_sort').click(function () {
            var url = $(this).attr('url');
            var ids = $('.ids:checked');
            var param = '';
            if (ids.length > 0) {
                var str = new Array();
                ids.each(function () {
                    str.push($(this).val());
                });
                param = str.join(',');
            }

            if (url != undefined && url != '') {
                window.location.href = url + '/ids/' + param;
            }
        });
    });
</script>
{/block}